Skip to content

Block save in readonly mode#407

Merged
mvilliger merged 1 commit into
releases/26.1from
features/mvi/26.1/contactBlockSaveInReadOnlyMode
Jun 3, 2026
Merged

Block save in readonly mode#407
mvilliger merged 1 commit into
releases/26.1from
features/mvi/26.1/contactBlockSaveInReadOnlyMode

Conversation

@mvilliger

Copy link
Copy Markdown
Member

Previously it was possible to save when pressing cancel.

461788

@mvilliger mvilliger requested a review from bschwarzent May 8, 2026 13:11

@Override
protected void execStore() {
BEANS.get(ContactsHelper.class).failIfReadOnly();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to show an exception? Maybe just doing nothing would be enough. This would also make it unnecessary to rename the save button to "Close". That the save button does not actually store anything should be obvious because of the label at the top right. We could also simply disable the save button and set askIfSaveNeeded to false.

Also, considering that the contacts app should be a public example of best practices, maybe apply this check in the service, not in the form? If the contacts app was ever ported to Scout JS, the check would have to be in the service anyway.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I removed the code that changed the buttons.
I added backend validation using permissions.
Now you get a permission denied message when trying to save in readOnly mode.
This implementation also adds an access control example which might be helpful?
Do you think we should disable the save buttons and change askIfSaveNeeded as well?

@mvilliger mvilliger force-pushed the features/mvi/26.1/contactBlockSaveInReadOnlyMode branch from 129aaaf to f666a2e Compare June 1, 2026 08:13
Previously it was possible to save when pressing cancel.

461788
@mvilliger mvilliger force-pushed the features/mvi/26.1/contactBlockSaveInReadOnlyMode branch from f666a2e to 3cfd3ce Compare June 3, 2026 05:58
@mvilliger mvilliger merged commit c42c059 into releases/26.1 Jun 3, 2026
1 check passed
@mvilliger mvilliger deleted the features/mvi/26.1/contactBlockSaveInReadOnlyMode branch June 3, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants